package com.tj.collection.db.domain;

import com.tj.collection.db.entity.RptChatterOnlinePreHourEntity;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class ChatterOnlineDto {
    private String chatterUserCode;
    private Integer queryDate;
    private String timeStage;
    private Integer onlineUserCnt;
    private Integer showWarningFlag;

    public static ChatterOnlineDto toDto(RptChatterOnlinePreHourEntity entity) {
        if (entity == null) {
            return null;
        }
        Integer nextHour = entity.getCreateHour() + 1;
        return ChatterOnlineDto.builder().chatterUserCode(entity.getChatterUserCode()).queryDate(entity.getCreateDt()).timeStage(entity.getCreateHour() + "_" + nextHour).onlineUserCnt(entity.getOnlineUserCnt()).showWarningFlag(entity.getWarningFlag()).build();
    }
}
